<template>
  <div id="app">
    <h3>count:{{$store.state.count}}</h3>  
    msg:{{$store.state.msg}}
    <h1> getter:{{reverseMsg}}</h1>
    <h2>mutations</h2>
    <button @click="setincrement(3)">mutations</button>
    <h2>actions</h2>
    <!-- <button @click="$store.dispatch('incrementSync',1.5)">actions</button> -->
    <!-- <button @click="incrementSync(2.5)">actions</button> -->
    <button @click="addIncrementSync(5)">actions</button>
    <!-- <h4>modules:{{$store.state.products.products}}</h4>
    <button @click="$store.commit('setProducts', [])">modules</button>  -->
    <h4>getproducts:{{getproducts}}</h4>
    <button @click="getProducts([])">modules</button> 

  </div>
</template>

<script>
// mapActions
import { mapState,mapGetters, mapMutations,mapActions } from 'vuex'
export default {
  name: 'App',
  computed:{
   ...mapGetters(["reverseMsg"]),
   ...mapState('products', {getproducts:'products'})
  },
  methods:{
    ...mapMutations(["increment"]),
    ...mapMutations({setincrement:"increment"}),
    ...mapActions(["incrementSync"]),
    ...mapActions({addIncrementSync:"incrementSync"}),
    ...mapMutations('products',{getProducts:"setProducts"})
  }
  
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
